<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- The HTML 4.01 Transitional DOCTYPE declaration-->
<!-- above set at the top of the file will set     -->
<!-- the browser's rendering engine into           -->
<!-- "Quirks Mode". Replacing this declaration     -->
<!-- with a "Standards Mode" doctype is supported, -->
<!-- but may lead to some differences in layout.   -->

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <meta name="gwt:property" content="locale=<%=request.getLocale()%>">

    <!--                                                               -->
    <!-- Consider inlining CSS to reduce the number of requested files -->
    <!--                                                               -->
    <link type="text/css" rel="stylesheet" href="Magicreader.css">
    
    <!-- If Internet Explorer -->
    <%
    	String userAgent = request.getHeader("User-Agent");
    	if(userAgent != null && userAgent.contains("MSIE")) { 
    %>
    <!-- Include additional stylesheet for Internet Explorer -->
    <link type="text/css" rel="stylesheet" href="Magicreader-ie.css">
    <%} %>

    <title>MagicReader (beta)</title>
    
    <!--                                           -->
    <!-- This script loads your compiled module.   -->
    <!-- If you add any GWT meta tags, they must   -->
    <!-- be added before this line.                -->
    <!--                                           -->
    <script type="text/javascript" language="javascript" src="magicreader/magicreader.nocache.js"></script>
    
    <!-- Connect JavaScript for Tagcloud widget -->
    <script type="text/javascript" src="swfobject.js"></script>
    
    <script type="text/javascript">
    	function getWindowHeight() {
    		if(parseInt(navigator.appVersion) > 3) {
        		if(navigator.appName == "Netscape") {
            		return window.innerHeight;
            	}
   			 	if (navigator.appName.indexOf("Microsoft") != -1) {
   	   			 	return document.body.offsetHeight; 
   			 	}
   			}

   			return window.innerHeigth;
    	}

    	function getWindowWidth() {
    		if(parseInt(navigator.appVersion) > 3) {
        		if(navigator.appName == "Netscape") {
            		return window.innerWidth;
            	}
   			 	if (navigator.appName.indexOf("Microsoft") != -1) {
   	   			 	return document.body.offsetWidth; 
   			 	}
   			}

   			return window.innerWidth;
    	}

    	function countTagcloudWidgetWidth() {
        	return getWindowWidth();
    	}

    	function countTagcloudWidgetHeight() {
        	return getWindowHeight() - 200;
    	}

    	function displayTagcloudLoader() {
			var width = countTagcloudWidgetWidth();
			var height = countTagcloudWidgetHeight();

			document.getElementById("flashcontent").innerHTML='<table height="' + height + '" width="' + width + '"><tr><td align="middle"><img src="ajax-loader-large.gif"></td><tr></table>';
    	}

    	function displayTagcloudWidgetLabel(text) {
    		var width = countTagcloudWidgetWidth();
			var height = countTagcloudWidgetHeight();

			document.getElementById("flashcontent").innerHTML='<table height="' + height + '" width="' + width + '"><tr><td align="middle"><h3>' + text + '</h3></td><tr></table>';
    	}

    	function refreshTagcloud() {
			var width = countTagcloudWidgetWidth();
			var height = countTagcloudWidgetHeight();

			var so = new SWFObject("tagcloud.swf", "tagcloud", width + '', height + '', "7");
			so.addParam("wmode", "transparent");
			so.addVariable("tcolor", "0x333333");
			so.addVariable("tcolor2", "0x009900");
			so.addVariable("hicolor", "0x000000");
			so.addVariable("tspeed", "100");
			so.addVariable("distr", "true");
			so.addVariable("xmlpath", "input.jsp");
			so.write("flashcontent");
  		}
	</script>
	
	<!-- Google Analytics -->
	<script type="text/javascript">
	  var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', 'UA-11393165-5']);
	  _gaq.push(['_trackPageview']);
	
	  (function() {
	    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();
	</script>
  </head>
  
  <!--                                           -->
  <!-- The body can have arbitrary html, or      -->
  <!-- you can leave the body empty if you want  -->
  <!-- to create a completely dynamic UI.        -->
  <!--                                           -->
  <body onresize="refreshTagcloud()">

    <!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
    <noscript>
      <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
        Your web browser must have JavaScript enabled
        in order for this application to display correctly.
      </div>
    </noscript>
    
    <div id="topPanel" align="center"></div>
    
    <br>
    <div id="newFeedPanel" align="center"></div>
    
	<div id="refreshButtonPanel" align="center"></div>
    
    <!-- Tagcloud widget -->
    <table border="0" cellpadding="0">
	  <tr>
	    <td>	
			<div id="flashcontent">You Must Enable Flash and Javascript In Order To Use This Service</div>
			<script type="text/javascript">
				refreshTagcloud();
			</script>
		</td>
			<div id="rightPanel" align="right"></div>
		<td>
		</td>
	  </tr>
	</table>
	
    <div id="tagcloudSubpanel" align="center"></div>
    
    <div class="footer">
		<span style="color: gray;">© 2010 Viktor Kazakov</span> <a href="http://code.google.com/appengine/privacy.html">Google Privacy Policy</a>
	</div>    
  </body>
</html>
